﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _6_字符串操作
{
    internal class StringDeal
    {

        public void StringCompareTest() {
            String a = "text";
            String b = "text";

            if (String.Compare(a, b) == 0)  // 一致返回0  不一致返回-1
            {   
                Console.WriteLine($"{a}和{b}相等");

            }
            else {

                Console.WriteLine($"{a}和{b}不相等");

            }

        }

        public void StringContainTest() {
            String a = "hello text , where are you";
            String b = "text";

            if (a.Contains(b))  // 包含返回True ,不包含时返回False
            {
                Console.WriteLine($"{a}里面包含{b}");
            }
            else {
                Console.WriteLine($"{a}里面不包含{b}");
            }
        }

        public static void Main(String[] args) {

            StringDeal s = new StringDeal();
            s.StringCompareTest();
            s.StringContainTest();


        }
    }
}
